<?php
class PersonalMenuForm extends Form
{
	function PersonalMenuForm()
	{
		Form::Form('PersonalMenuForm');
        $this->link_css('style/front-personal-menu.css');
        $this->link_css('style/msgBoxLight.css');
        $this->link_js('javascript/jquery/jquery-ui-1.9.2.custom.min.js');
        $this->link_js("javascript/jquery/jquery.msgBox.js");
	}

	function draw()
	{
		global $display;
                $url_array = explode('/', $_SERVER['REQUEST_URI']);
                if(sizeof($url_array) >= 3){
                    $check = explode('?', $url_array[2]);
                    $display->add('active',$check[0]);
                }
        if(User::is_root() || User::is_admin_hotel()){
            $display->add('admin','2');
        }
        $hotel_ids = Db_Hotel::get_hotel_ids(User::id());
        if($hotel_ids != ''){
            $count = explode(',', $hotel_ids);
            $display->add('num',  sizeof($count));
            $display->add('cart',  count(DB::fetch_all_array("SELECT id FROM booking WHERE hotel_id IN ($hotel_ids) group by cart_id", __FILE__ . ' line ' . __LINE__)));
            //$display->add('cart',  sizeof(DB::count('booking', "hotel_id IN ($hotel_ids) group by cart_id")));
            $display->add('deal_cart',  count(DB::fetch_all_array("SELECT id FROM deal_booking WHERE hotel_id IN ($hotel_ids) group by cart_id", __FILE__ . ' line ' . __LINE__)));
        }
        if(User::is_admin_hotel()){
            $display->add('hotel_admin','2');
        }
        $display->add('WEB_DIR',WEB_DIR);
		$display->output('personal_menu');
	}
        
}
?>